<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
    xmlns:a="http://richfaces.org/a4j"
    template="layout/template.xhtml">

<ui:define name="body">

	<h2 class="title"><a href="#">Gerenciar Vales</a></h2><br/>
	
            <h:form id="valeForm">
            
	           <h:panelGrid columns="1">
	            	<s:decorate template="/layout/edit.xhtml">
	            		<ui:define name="label">Tipo do Vale:</ui:define>
	            		<h:selectOneMenu value="#{manterValeController.idTipoVale}"
	            			required="true">
	            			<f:selectItems value="#{manterValeController.listaTiposVale}" />
	            		</h:selectOneMenu>
	            	</s:decorate>
	            	
	            	<s:decorate template="/layout/edit.xhtml">
	            		<ui:define name="label">Funcionário:</ui:define>
	            		<h:selectOneMenu value="#{manterValeController.idFuncionario}"
	            			required="false">
	            			<f:selectItems value="#{manterValeController.listaFuncionarios}" />
	            		</h:selectOneMenu>
	            	</s:decorate>
	            	
	            	<s:decorate template="/layout/edit.xhtml">
	            		<ui:define name="label">Data do vale:</ui:define>
	            		<rich:calendar value="#{manterValeController.valeEdicao.dtaVale}"
	            			datePattern="dd/MM/yyyy"
	            			required="true"
	            			enableManualInput="true"
	            			oninputkeydown="Mascara(this,Data)"
	            			oninputkeyup="Mascara(this,Data)"/>
	            	</s:decorate>
	            	
	            	<s:decorate template="/layout/edit.xhtml">
	            		<ui:define name="label">Valor:</ui:define>
	            		<h:inputText value="#{manterValeController.valeEdicao.vlrVale}" 
	            			maxlength="10"
	            			required="true"
	            			onkeydown="Mascara(this,Valor)"
	            			onkeyup="Mascara(this,Valor)"
	            			converter="conversorMonetario"/>
	            		
	            	</s:decorate>
	            </h:panelGrid>
	            <h:panelGrid columns="1">
	            	<s:decorate template="/layout/edit.xhtml">
	            		<ui:define name="label">Observação:</ui:define>
	            		<h:inputTextarea value="#{manterValeController.valeEdicao.dscObservacao}" 
	            			cols="60"
	            			rows="5">
	            			<f:validateLength maximum="300"/>
	            		</h:inputTextarea>
	            		
	            	</s:decorate>
	            </h:panelGrid>
	            <br/>
	            <div class="actionButtons">
		        	<h:commandButton id="submit" value="Salvar" action="#{manterValeController.salvar}"
		            	onclick="javascript:if(!confirm('Tem certeza que deseja salvar?'))return false;"/>
		            	
		            <a:commandButton id="cancel" value="Cancelar" 
				        		action="#{manterValeController.cancelar}" 
				        		ajaxSingle="true"
				        		reRender="funcionarioForm"/>
		        </div>
				<br/>
				
			</h:form>

 </ui:define>
</ui:composition>
